#define _CRT_SECURE_NO_WARNINGS 1
#include"binarytree.h"

BtNode* BuyNode(BTDataType x)
{
	BtNode* Node = (BtNode*)malloc(sizeof(BtNode));
	if (Node == NULL)
	{
		perror("Failure\n");
		exit(1);
	}
	Node->data = x;
	Node->rightNode = NULL;
	Node->leftNode = NULL;
	return Node;
}

void preorder(BtNode* root)
{
	if (root == NULL)
	{
		printf("NULL ");
		return;
	}
	printf("%c ", root->data);
	preorder(root->leftNode);
	preorder(root->rightNode);
}

void inorder(BtNode* root)
{
	if (root == NULL)
	{
		printf("NULL ");
		return;
	}
	inorder(root->leftNode);
	printf("%c ", root->data);
	inorder(root->rightNode);
}

void postorder(BtNode* root)
{
	if (root == NULL)
	{
		printf("NULL ");
		return;
	}
	postorder(root->leftNode);
	postorder(root->rightNode);
	printf("%c ", root->data);
}